# main.py
from config import config
from voxel_processor import VoxelProcessor

def main():
    # 初始化处理器
    processor = VoxelProcessor(config)

    # 加载 VOX 模型
    processor.load_vox_file(config.VOX_FILE)

    # 生成帧数据
    if config.ANIMATION_MODE == "projection":
        frame_data = processor.generate_projection_slices()
        output_file = f"{config.VOX_FILE}_projection.bin"
    elif config.ANIMATION_MODE == "y_slice":
        frame_data = processor.generate_y_axis_slices(
            slice_height=config.SLICE_HEIGHT,
            dynamic_slice=config.DYNAMIC_SLICE
        )
        output_file = f"{config.VOX_FILE}_yslice.bin"
    elif config.ANIMATION_MODE == "z_y0_slice":
        frame_data = processor.generate_z_axis_y0_slices()
        output_file = f"{config.VOX_FILE}_z_y0slice.bin"
    else:
        raise ValueError(f"无效的动画模式: {config.ANIMATION_MODE}")

    # 保存数据
    processor.save_to_binary(frame_data, output_file)


if __name__ == "__main__":
    main()
